﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserTelList.aspx.cs" Inherits="ZLDC.Estate.TM.UserTelList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>公共通讯簿</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.simple.tree.css" rel="stylesheet" type="text/css" />
    <script src="../js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../js/jquery/jquery.simple.tree.js" type="text/javascript"></script>
    <script src="../js/jquery.autocomplete.js" type="text/javascript"></script>

    <script src="../js/LexunJS.js" type="text/javascript"></script>
    <link href="../js/jquery.autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-attachment: fixed; background-repeat: no-repeat">
    <form id="Form1" method="post" runat="server">
    <div id="dvDept" style="overflow: auto; z-index: 2; position: absolute; display: none;
        border: 1px; border-style: outset; background-color: #ffffff; height: 420px;
        width: 200px">
        <asp:Literal ID="ltlDeptTree" runat="server"></asp:Literal>
    </div>
    <table cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td colspan="3">
                <b>公共通讯簿</b>
            </td>
        </tr>
        <tr>
            <td align="right">
                部门：
            </td>
            <td>
                <asp:RadioButton ID="rbSel" runat="server" Checked="true" GroupName="dept" />
                <asp:HyperLink ID="hlkDept" runat="server" Text="请选择部门" NavigateUrl="javascript:showDept('dvDept')"></asp:HyperLink>
                <asp:HiddenField ID="hiddDeptId" runat="server" />
                <asp:HiddenField ID="hiddDeptName" runat="server" />
                <asp:RadioButton ID="rbInput" runat="server" GroupName="dept" />
                <asp:TextBox ID="tbDeptInput" runat="server" Width="180px"></asp:TextBox>拼音首字母提示
            </td>
        </tr>
        <tr>
            <td>
                姓名/电话：
            </td>
            <td>
                <asp:TextBox ID="tbKey" ToolTip="拼音首字母提示,格式:姓名[工号,部门]" runat="server"></asp:TextBox>
                <asp:Button ID="btnSearch" runat="server" OnClientClick="return chkDept();" 
                    Text="查询"  CssClass="button_bak" onclick="btnSearch_Click"/>
                
            </td>
        </tr>
    </table>
   
         <table style="width: 100%; text-align:center;">
                    <tr>
                        <td style="background-color: #FFFFFF; vertical-align: top;">
                            <asp:GridView ID="gvArea" runat="server" AutoGenerateColumns="False"
                                AllowPaging="True"  OnRowDataBound="gvArea_RowDataBound"
                                Width="100%" OnPageIndexChanging="gvArea_PageIndexChanging">
                                <Columns>
                                    <asp:BoundField DataField="name" HeaderText="姓名" />
                                    <asp:BoundField DataField="sex" HeaderText="性别" />
                                    <asp:BoundField DataField="station" HeaderText="职位" />
                                    <asp:BoundField DataField="deptname" HeaderText="部门" />
                                    <asp:BoundField DataField="tel" HeaderText="电话" />
                                    <asp:BoundField DataField="curtmobile" HeaderText="短号" />
                                    <asp:BoundField DataField="rzsj" HeaderText="入职时间" />          
                                </Columns>
                                <HeaderStyle BackColor="#F1FADE" />
                            </asp:GridView>
                        </td>
                    </tr>
                  
                </table>


    <script language="javascript" type="text/javascript">
        $("#tbKey").autocomplete("../Ajax/GetUserAuto.aspx",
        { minChars: 2,
            extraParams: {
                uname: function() {
                    return escape($('#tbKey').val());
                }
            },
            scrollHeight: 200, width: 250, max: 100
        });
        
        //部门
        $("#tbDeptInput").autocomplete("../Ajax/GetDeptAuto.aspx", { minChars: 2, extraParams: { dpname: function() { return escape($('#tbDeptInput').val()); } }, scrollHeight: 300, width: 200, max: 100,parse: function(data) {
                if (data == "" || data == undefined)
                    return false;

                return $.map(eval(data), function(row) {
                    return {
                        data: row,
                        value: row.id,
                        result: row.name
                    }
                });
            },
            formatItem: function(item) {
                return item.name;
            }

        });
        
        
        var simpleTreeCollection;
        $(document).ready(function() {
            simpleTreeCollection = $('.simpleTree').simpleTree({
                autoclose: false,
                drag: false,
                afterClick: function(node) {
                    //alert('text-'+$('span:first',node).text());
                },
                afterDblClick: function(node) {
                    // alert('text-' + $('span:first', node).text());
                },
                afterMove: function(destination, source, pos) {
                    //alert('destination-'+destination.attr('id')+' source-'+source.attr('id')+' pos-'+pos);
                },
                afterAjax: function() {
                    //alert('Loaded');
                },
                animate: false
                //,docToFolderConvert:true
            });
          
        });

        function showDept(obj) {
            obj = document.getElementById(obj)
            var dptName = $("#hlkDept").html();
            dptName = new String(dptName);
            dptName = dptName.replace('↓', '').replace('↑', '');
            if (obj.style.display == 'block') {
                obj.style.display = 'none';
                dptName = dptName + '↓';

            }
            else {
                obj.style.display = 'block';
                dptName = dptName + '↑';

            }
            $("#hlkDept").html(dptName);
            $("#hiddDeptName").val(dptName);
            //定位
            var p = $("#hlkDept");
            var position = p.position();
            obj.style.left = position.left;
            obj.style.top = position.top + 18;
        }
        function writing() {
            document.getElementById("messageZone").style.display = "block";
        }
        function jt(did, dname) {
            document.getElementById("hiddDeptId").value = did;
            document.getElementById("hlkDept").innerText = dname;
            showDept('dvDept');
        }
        function chkDept() {
            if (document.getElementById("rbInput").checked == true) {
                cc = document.getElementById("tbDeptInput")
                if (LexunJS.Trim(cc.value)==''){
                
                    alert('请录入部门名称!');
                    cc.focus();
                    return false;
                }
            }
        }
    </script>

    </form>
</body>
</html>
